package org.ashleygwinnell.snahs;

import java.io.OutputStream;
import java.util.ArrayList;


public abstract class RequestHandler
{
	private final ArrayList<String> lines = new ArrayList<String>();
	
	private ThreadedRequest request;
	
	public abstract String getType();
	
	public abstract void handleRequest() throws Exception;
	public abstract void handleResponse() throws Exception;
	
	public final void setThreadedRequest(ThreadedRequest r)
	{
		this.request = r;
	}
	
	public final ThreadedRequest getThreadedRequest() {
		return request;
	}
	
	public final SimpleHTTPServer getServer()
	{
		return request.getServer();
	}
	
	public final void addLine(String line) 
	{
		this.lines.add(line);
	}
	public final ArrayList<String> getLines()
	{
		return this.lines;
	}
	
	public final OutputStream getOutputStream()
	{
		return this.getThreadedRequest().getOutputStream();
	}
}